# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.BareMetalSolution.V2.Model.GoogleCloudBaremetalsolutionV2LogicalInterface do
  @moduledoc """
  Each logical interface represents a logical abstraction of the underlying physical interface (for eg. bond, nic) of the instance. Each logical interface can effectively map to multiple network-IP pairs and still be mapped to one underlying physical interface.

  ## Attributes

  *   `interfaceIndex` (*type:* `integer()`, *default:* `nil`) - The index of the logical interface mapping to the index of the hardware bond or nic on the chosen network template. This field is deprecated.
  *   `logicalNetworkInterfaces` (*type:* `list(GoogleApi.BareMetalSolution.V2.Model.LogicalNetworkInterface.t)`, *default:* `nil`) - List of logical network interfaces within a logical interface.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Interface name. This is of syntax or and forms part of the network template name.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :interfaceIndex => integer() | nil,
          :logicalNetworkInterfaces =>
            list(GoogleApi.BareMetalSolution.V2.Model.LogicalNetworkInterface.t()) | nil,
          :name => String.t() | nil
        }

  field(:interfaceIndex)

  field(:logicalNetworkInterfaces,
    as: GoogleApi.BareMetalSolution.V2.Model.LogicalNetworkInterface,
    type: :list
  )

  field(:name)
end

defimpl Poison.Decoder,
  for: GoogleApi.BareMetalSolution.V2.Model.GoogleCloudBaremetalsolutionV2LogicalInterface do
  def decode(value, options) do
    GoogleApi.BareMetalSolution.V2.Model.GoogleCloudBaremetalsolutionV2LogicalInterface.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.BareMetalSolution.V2.Model.GoogleCloudBaremetalsolutionV2LogicalInterface do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
